package com.niit.session17;

import java.util.Set;
import java.util.TreeSet;

public class TreeSetDemo {
	public static void main(String[] args) {
		Set<Integer> treeSet = new TreeSet<Integer>();
//		TreeSet会对插入的元素进行排序
		treeSet.add(12);
		treeSet.add(1212);
		treeSet.add(15);
		treeSet.add(120);
//		set接口所有的实现类都具备去重的功能
		treeSet.add(92);
		treeSet.add(92);
		treeSet.add(92);
		treeSet.add(92);
		System.out.println(treeSet);
		TreeSet<Student> students = new TreeSet<Student>();
		students.add(new Student("张三",18));
		students.add(new Student("赵六",23));
		students.add(new Student("李四",22));
		students.add(new Student("王五",21));
		System.out.println(students);
	}

}
